package helper
{
	import flash.events.MouseEvent;
	
	import mx.controls.Label;
	import mx.core.Application;
	import mx.events.FlexEvent;
	
	import view.NineSoundView;

	public class NineSoundHelper extends NineSoundView
	{
		public function NineSoundHelper()
		{
			super();
			addEventListener(FlexEvent.CREATION_COMPLETE, init);
		}
		
		public function init(event:FlexEvent):void{
			oneOpen.addEventListener(MouseEvent.CLICK, openButtonHandler);
			twoOpen.addEventListener(MouseEvent.CLICK, openButtonHandler);
			threeOpen.addEventListener(MouseEvent.CLICK, openButtonHandler);
		}
		
		public function openButtonHandler(event:MouseEvent):void{
			var s:String = event.target.toString();
			var ss:String = s.slice(s.lastIndexOf(".")+1, s.length+1);
			trace(event.target + " " + ss);
			var sp:String = ss.slice(0,ss.lastIndexOf("Open")) + "Path";
			trace(sp);
			//var label:Label = getChildByName(sp) as Label;
			this[sp].text = sp;
//			trace(Application.application.nine.getChildByName(sp));
//			label.text = "!!!!!";
			
		}
		
	}
}